主题
启动远程调度服务 - StartRemoteServer
函数简介
在 B 端 机器上启动 OLAPlug 远程调度服务:监听指定地址与端口,接受 A 端 连接并代为执行接口调用。每个 instance 只能启动一个远程服务。
接口名称
StartRemoteServerDLL调用
c
int64_t StartRemoteServer(int64_t instance, char* bindAddr, int32_t port, char* token);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 接口生成。 |
| bindAddr | 字符串 | 绑定地址;空串或 "0.0.0.0" 表示监听所有网卡。 |
| port | 整数型 | 监听端口,默认 19527。 |
| token | 字符串 | 非空:与 A 端配置的 RemoteToken 一致(旧版鉴权); |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken");csharp
using OLAPlug;
var ola = new OLAPlugServer();
long handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
long handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken");cpp
var ola = com("OlaPlug.OlaSoft")
var handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken")text
.局部变量 ola, OLAPlug
ola.创建 ()
handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken")aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
long handle = ola.StartRemoteServer("0.0.0.0", 0, "RemoteToken");原生 DLL 调用
cpp
StartRemoteServer(instance, "0.0.0.0", 0, "RemoteToken");csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int StartRemoteServer(long ola, string bindAddr, int port, string token);
StartRemoteServer(instance, "0.0.0.0", 0, "RemoteToken");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.StartRemoteServer(instance, "0.0.0.0", 0, "RemoteToken")返回值
服务句柄:大于 0 表示成功,0 表示失败。
注意事项
- 仅 B 端调用;A 端不需要调用本接口。
- 每个
instance只能存在一个远程服务;停止请使用 停止远程调度服务 - StopRemoteServer。 - A 端连接参见 连接远程服务端 - ConnectRemote 等接口。
